home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4621 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  41 lines

  1. Path: library.erc.clarkson.edu!koglerje
  2. From: koglerje@craft.camp.clarkson.edu (Mountain (jimbo) )
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Can main() function be called?
  5. Date: 6 Feb 1996 04:59:19 GMT
  6. Organization: Clarkson University
  7. Message-ID: <4f6n77$e53@library.erc.clarkson.edu>
  8. References: <823183263.118@fountain.demon.co.uk> <4f1mv0$2fd@cloner4.netcom.com>
  9. NNTP-Posting-Host: craft.camp.clarkson.edu
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Mike Rosenblyum (rozen@ix.netcom.com) wrote:
  13. : I think that it cannot be done, I see no reasonalbe way how main()
  14. : could be called more than once.
  15.  
  16.  
  17. :    What is your thoughts on this?
  18.  
  19.  
  20. Sure you can call main() again, well kindof,  just uses setjmp()
  21. and longjmp() just put a setjump() call inside main() like:
  22.  
  23. int main()
  24. {
  25.   setjmp(jmp_buf hi);
  26.   ..
  27. }
  28.  
  29. then when you want to "run main()" again, just call longjmp(jmp_buff hi, int i);
  30. you will have to look up the specifics but this is standard across the platforms. the real question is WHY would you want to do this??????
  31.  
  32. hope i was of some assistance.
  33. jimbo
  34. koglerje@wckn.dorm
  35.  
  36. --
  37. ----
  38.   just another sig
  39.  
  40.  
  41.